﻿// **************************************************
// 以下代码由代码生成器生成。
// 请不要修改该文件，以避免您的修改被代码生成器覆盖。
// 如需扩展方法，可新建文件，利用partial类特性来实现。
// **************************************************
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace {{namespace}}
{
    [RemoteService(Name = {{project_group_name}}RemoteServiceConsts.RemoteServiceName)]
    [Area({{project_group_name}}RemoteServiceConsts.ModuleName)]
    [ControllerName("{{class_name}}")]
    [Route("api/{{ to_kebab_case project_group_name }}/{{ to_kebab_case class_name }}")]
    public partial class {{class_name}}Controller : {{project_group_name}}Controller, I{{class_name}}AppService
    {
        protected I{{class_name}}AppService {{class_name}}AppService => LazyServiceProvider.LazyGetRequiredService<I{{class_name}}AppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<{{class_name}}Dto> GetAsync(Guid id)
        {
            return {{class_name}}AppService.GetAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<{{class_name}}Dto> FindAsync(string filter)
        {
            return {{class_name}}AppService.FindAsync(filter);
        }

        [HttpGet]
        public Task<PagedResultDto<{{class_name}}Dto>> GetListAsync(FilterRequestDto input)
        {
            return {{class_name}}AppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<{{class_name}}Dto>> QueryAsync(FilterGroupRequestDto input)
        {
            return {{class_name}}AppService.QueryAsync(input);
        }

        [HttpPost]
        [Route("get-children")]
        public Task<ListResultDto<{{class_name}}Dto>> GetChildrenAsync(Guid? parentId, bool recursive = false)
        {
            return {{class_name}}AppService.GetChildrenAsync(parentId, recursive);
        }

        [HttpPost]
        public Task<{{class_name}}Dto> CreateAsync({{class_name}}CreateDto input)
        {
            return {{class_name}}AppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<{{class_name}}Dto> UpdateAsync(Guid id, {{class_name}}UpdateDto input)
        {
            return {{class_name}}AppService.UpdateAsync(id, input);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return {{class_name}}AppService.DeleteAsync(id);
        }
    }
}
